﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;

namespace Line64.ImageFlow.Activities
{

    public sealed class SaveBitmapActivity : CodeActivity
    {
        
        public InArgument<string> OutputPath { get; set; }

        public InArgument<ImageFormat> OutputFormat { get; set; }

        public InArgument<Bitmap> InputBitmap { get; set; }

        protected override void Execute(CodeActivityContext context)
        {

            string imagePath = this.OutputPath.Get(context);
            ImageFormat imageFormat = this.OutputFormat.Get(context);

            Image inputImage = this.InputBitmap.Get(context);

            inputImage.Save(imagePath, imageFormat);
            
        }

    }

}